/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.escom.healthlc.ws;

import com.escom.healthlc.entidad.MedicoVO;
import com.escom.healthlc.entidad.PacienteVO;
import com.escom.healthlc.entidad.UsuarioVO;
import com.escom.healthlc.imapperdao.IPacienteMapper;
import com.escom.healthlc.imapperdao.IUsuarioMapper;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 *
 * @author Carlos
 */
@Controller
@RequestMapping("/medicoWebService")
public class MedicoWebService {
    
    private static final Logger logger = LoggerFactory.getLogger(MedicoWebService.class);
    
    @Autowired
    private IUsuarioMapper usuarioMapper;
    
    @RequestMapping(method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"})
    public @ResponseBody
    MedicoVO getMedicoByUsuarioJSON(@RequestParam(value = "nick") String nick, @RequestParam(value = "pass") String pass) {
        UsuarioVO usuario = new UsuarioVO();
        usuario.setNick(nick);
        usuario.setPass(pass);
        MedicoVO medico = usuarioMapper.retrieveMedicoByUsuario(usuario);
        logger.debug("medico {}", medico);
        return medico;
    }
}
